﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Input;
// using UnityEngine.Experimental.Input.Plugins.PlayerInput;
public class test : MonoBehaviour
{
    public InputAction inputAction;
    public ctest newControls;
    // Start is called before the first frame update
    void Start()
    {
       
        //newControls = new ctest();
        newControls.Enable();
      //  print(newControls);
        newControls.player.move.performed += Test;
    }
    private void Test(InputAction.CallbackContext context)
    {
        print("sdfsdfsdf");
        Debug.Log(context.control.name);
    }
    // Update is called once per frame
    void Update()
    {
        // print(Keyboard.current);
        if (Keyboard.current.dKey.wasPressedThisFrame)
        {
            Debug.Log("D key was pressed");
        }



        Mouse mouse = Mouse.current;
        //鼠标左键
        if (mouse.leftButton.wasPressedThisFrame)
        {
//            Debug.Log("left button");
        }
        //鼠标右键
        if (mouse.rightButton.wasPressedThisFrame)
        {
            Debug.Log("right button");
        }
        //鼠标中键
        if (mouse.middleButton.wasPressedThisFrame)
        {
            Debug.Log("middle button");
        }
        //鼠标前侧键
        if (mouse.forwardButton.wasPressedThisFrame)
        {
            Debug.Log("forward button");
        }
        //鼠标后侧键
        if (mouse.backButton.wasPressedThisFrame)
        {
            Debug.Log("back button");
        }
        // Debug.Log(Mouse.current.position.ReadValue());
        // Debug.Log(Mouse.current.delta.ReadValue());
        // Debug.Log(Mouse.current.scroll.ReadValue());
    }

    // public void OnMove(InputAction context)
    // {
    //     Debug.Log("Device Found");
    // }
    // public void OnDeviceLost(PlayerInput input)
    // {
    //     Debug.Log("Device Found");
    // }
    // public void OnDeviceRegained(PlayerInput input)
    // {
    //     Debug.Log("Device Found");
    // }
}
